import { storage } from "quant-ui";


/***设置登陆状态 start */
const USERSTATE = "quant-userState"
export function setUserStatu() {
    storage.set(USERSTATE, "admin")
}
export function getLoginStatu() {
    return storage.get(USERSTATE, "guest") === "admin"
}
export function removeUserStatu() {
    return storage.remove(USERSTATE)
}
/***设置登陆状态 end */

export function setUser(userData) {
    window.localStorage.setItem("note-in-life-user", JSON.stringify(userData))
}

export function deleteUser() {
    window.localStorage.removeItem("note-in-life-user")
}

export function getUser() {
    let _user = window.localStorage.getItem("note-in-life-user")
    let user = {}
    try {
        user = JSON.parse(_user) || {}
    } catch (error) {

    }
    return user;
}